﻿<UserControl x:Class="EpiDashboard.NutritionChartControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    
    xmlns:EpiDashboard="clr-namespace:EpiDashboard"    
    xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
    Background="#CCFFFFFF">
    <Grid>
        <GroupBox Margin="0,0,5,0">
            <GroupBox.Header>
                <TextBlock x:Name="grpHeader" FontWeight="Bold">Growth Chart</TextBlock>
            </GroupBox.Header>
            <Grid>
                <TextBlock x:Name="txtError" Text="Error" Margin="0, 52, 0, 0" FontWeight="Bold" Visibility="Collapsed">Error Message</TextBlock>
                <StackPanel HorizontalAlignment="Left" VerticalAlignment="Top">
                    <Grid>
                        <EpiDashboard:WaitCursor x:Name="waitCursor" Width="25" Height="25" Visibility="Collapsed" StackPanel.ZIndex="99" HorizontalAlignment="Right" VerticalAlignment="Top"/>
                    </Grid>
                    <Grid Name="grdChart" HorizontalAlignment="Center" Margin="0,10,0,0">
                      <StackPanel x:Name="pnlChartContainer" Background="White" ContextMenuService.IsEnabled="True">                          
                            <d3:ChartPlotter Name="plotter" Margin="10,10,20,10">
                                <d3:ChartPlotter.HorizontalAxis>
                                    <d3:HorizontalAxis Name="xAxis"/>
                                </d3:ChartPlotter.HorizontalAxis>
                                <d3:ChartPlotter.VerticalAxis>
                                    <d3:VerticalAxis Name="yAxis"/>
                                </d3:ChartPlotter.VerticalAxis>

                                <d3:Header FontFamily="Arial" Content="" Name="ChartTitle"/>
                                <d3:Header FontFamily="Arial" FontSize="16" Content="Patient: John Smith" Name="ChartSubTitle"/>
                                <d3:VerticalAxisTitle FontFamily="Arial" Content="Measurement" Name="yAxisTitle"/>
                                <d3:HorizontalAxisTitle FontFamily="Arial" Content="Age" Name="xAxisTitle"/>

                            </d3:ChartPlotter>
                            <StackPanel.ContextMenu>
                                <ContextMenu>
                                    <MenuItem x:Name="mnuLabel" Header="Set/Change Labels"/>
                                    <MenuItem x:Name="mnuChangeType" Header="Change Chart Type" IsEnabled="False"/>
                                    <Separator/>
                                    <MenuItem x:Name="mnuSave" Header="Save As Image..."/>
                                    <MenuItem x:Name="mnuPrint" Header="Print..."/>
                                </ContextMenu>
                            </StackPanel.ContextMenu>
                        </StackPanel>
                        <StackPanel Orientation="Vertical" Margin="10,-15,-10,0" HorizontalAlignment="Right" VerticalAlignment="Top" >
                            <Grid x:Name="ConfigGrid" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0" >
                                <Path x:Name="ConfigCollapsedTriangle" Canvas.ZIndex="100" Height="10" HorizontalAlignment="Right" Margin="0,19,15.375,0" VerticalAlignment="Top" Width="10" Fill="#995C90B2"
                  Stretch="Fill" Stroke="#FF666666" Data="M85,25 L85,25 L87.5,30 L90,25 z" RenderTransformOrigin="3.083,-1.417" Visibility="Collapsed"
                  StrokeThickness="0"/>
                                <Path x:Name="ConfigExpandedTriangle" Canvas.ZIndex="100" Height="10" HorizontalAlignment="Right" Margin="0,16.931,15.294,0" VerticalAlignment="Top" Width="10" Stretch="Fill"
                  Stroke="#FF666666" Data="M85,30 L85,30 L87.5,25 L90,30 z" RenderTransformOrigin="3.083,-1.417" Fill="#995C90B2"
                  StrokeThickness="0"/>
                                <Rectangle Fill="#22000000" RadiusX="10" RadiusY="10" Margin="0,4,0,0" />
                                <Rectangle Fill="#775C90B2" Stroke="Gray"  RadiusX="10" RadiusY="10" Margin="0,0,0,5" />
                                <Rectangle Fill="#DDFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10,10,10,15" />
                                <TextBlock x:Name="ConfigCollapsedTitle" TextAlignment="Center" Text="Growth Chart Properties" Margin="30.331,15.069,29.669,0" FontWeight="Bold"
                       Height="16" VerticalAlignment="Top" RenderTransformOrigin="0.501,1.017" Visibility="Collapsed" />
                                <StackPanel Orientation="Vertical" Margin="25" HorizontalAlignment="Center" VerticalAlignment="Top" >
                                    <TextBlock HorizontalAlignment="Center" TextAlignment="Center" Text="Growth Chart Properties" Margin="5" FontWeight="Bold" />

                                    <TextBlock x:Name="txtPatientIdField" HorizontalAlignment="Left" TextAlignment="Center" Text="Patient ID field to use:" Margin="0,5,0,0"  />
                                    <ComboBox x:Name="cbxPatientIdField" HorizontalAlignment="Left" SelectedIndex="0" Width="160" >                                        
                                    </ComboBox>

                                    <TextBlock x:Name="txtGenderField" HorizontalAlignment="Left" TextAlignment="Center" Text="Gender field (must be coded M/F):" Margin="0,5,0,0"  />
                                    <ComboBox x:Name="cbxGenderField" HorizontalAlignment="Left" SelectedIndex="0" Width="160" >
                                    </ComboBox>

                                    <TextBlock x:Name="txtHeightField" Visibility="Collapsed" HorizontalAlignment="Left" TextAlignment="Center" Text="Height field (inches):" Margin="0,5,0,0"  />
                                    <ComboBox x:Name="cbxHeightField" Visibility="Collapsed" HorizontalAlignment="Left" SelectedIndex="0" Width="160" >
                                    </ComboBox>

                                    <TextBlock x:Name="txtWeightField" Visibility="Collapsed" HorizontalAlignment="Left" TextAlignment="Center" Text="Weight field (pounds):" Margin="0,5,0,0"  />
                                    <ComboBox x:Name="cbxWeightField" Visibility="Collapsed" HorizontalAlignment="Left" SelectedIndex="0" Width="160" >
                                    </ComboBox>

                                    <TextBlock x:Name="txtAgeField" Visibility="Collapsed" HorizontalAlignment="Left" TextAlignment="Center" Text="Age field (months):" Margin="0,5,0,0"  />
                                    <ComboBox x:Name="cbxAgeField" Visibility="Collapsed" HorizontalAlignment="Left" SelectedIndex="0" Width="160" >
                                    </ComboBox>

                                    <TextBlock x:Name="txtMeasurementField" HorizontalAlignment="Left" TextAlignment="Center" Text="BMI field:" Margin="0,5,0,0"  />
                                    <ComboBox x:Name="cbxMeasurementField" HorizontalAlignment="Left" SelectedIndex="0" Width="160" >
                                    </ComboBox>

                                    <TextBlock x:Name="txtPatientId" HorizontalAlignment="Left" TextAlignment="Center" Text="Patient ID to chart:" Margin="0,5,0,0"  />
                                    <ComboBox x:Name="cbxPatientId" HorizontalAlignment="Left" SelectedIndex="0" Width="160" >
                                    </ComboBox>

                                    <TextBlock x:Name="txtUnits" HorizontalAlignment="Left" TextAlignment="Center" Text="Units:" Margin="0,5,0,0"  />
                                    <ComboBox x:Name="cbxUnits" HorizontalAlignment="Left" SelectedIndex="0" Width="160" >                                        
                                    </ComboBox>

                                    <StackPanel Height="10"></StackPanel>
                                    
                                    <CheckBox x:Name="checkboxShowLegend" Content="Show legend" IsChecked="True" Margin ="0, 5, 0, 0"/>
                                    <CheckBox x:Name="checkboxShowTallChart" Content="Use tall chart" IsChecked="False" Margin ="0, 5, 0, 0"/>
                                    <CheckBox x:Name="checkboxBlackAndWhite" Content="Black and white curves only" IsChecked="False" Margin ="0, 5, 0, 0"/>

                                    <StackPanel Height="20"></StackPanel>
                                    <Button x:Name="btnRun" Content="Generate Chart" Click="btnRun_Click" />

                                </StackPanel>
                            </Grid>
                        </StackPanel>

                    </Grid>
                </StackPanel>
            </Grid>
        </GroupBox>
        <Image x:Name="imgClose" Source="Images\x.png" HorizontalAlignment="Right" VerticalAlignment="Top"/>
    </Grid>
</UserControl>
